package com.itheima.d1_api_objects;

import java.util.Objects;

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;

/*
    Objects是一个工具类，提供了很多操作对象的静态方法给我们使用。
        public static boolean equals(Object a, Object b)	先做非空判断，再比较两个对象
        public static boolean isNull(Object obj) 	判断对象是否为null，为null返回true ,反之
        public static boolean nonNull(Object obj) 	判断对象是否不为null，不为null则返回true, 反之
 */
public class Test {
    public static void main(String[] args) {

        Student student=new Student("小明");

        Student student1=new Student("小军");
        Student student2=new Student("小明");
        System.out.println(student.equals(student1));
        System.out.println("---");
        boolean aNull = isNull(student);
        System.out.println(aNull);
        System.out.println("-");
        boolean flag=nonNull(student2);
        System.out.println(flag);
    }
}
